-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implementation of torch.cdist function to pytorch frontend. #27004
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Compliance Checks
Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.
Protected Branch
In order to be considered for merging, the pull request changes must not be implemented on the "main" branch. This is described in our Contributing Guide. We are closing this pull request and we would suggest that you implement your changes as described in our Contributing Guide and open a new pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats on making your first Pull Request and thanks for supporting Ivy! 🎉
Join the conversation in our Discord.
For every PR opened, we run unit tests and comment the results in the PR to ensure the functionality remains intact.
Please make sure they are passing. 💪
If you want to check them from the action runners, you can open the display_test_results
job. 👀
It contains the following two sections:
- Combined Test Results: This shows the results of all the ivy tests that ran on the PR. ✔️
- New Failures Introduced: This lists the tests that fail on this PR.
Keep in mind that we will assign an engineer for this task and they will look at it based on the workload that they have, kindly be patient 😄.
Thank you for this PR, here is the CI results: This pull request does not result in any additional test failures. Congratulations! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joyios1 Thanks for making the PR! I've left a couple of minor comments but otherwise this looks good, so if we can get these addressed then we should be good to merge.
ivy_tests/test_ivy/test_frontends/test_torch/test_miscellaneous_ops.py
Outdated
Show resolved
Hide resolved
oh, yes, I forgot it. Co-authored-by: Sam Armstrong <88863522+Sam-Armstrong@users.noreply.github.com>
…s_ops.py Yes that is better. I did the change and the tests pass, so it is fine! Co-authored-by: Sam Armstrong <88863522+Sam-Armstrong@users.noreply.github.com>
PR Description
Hello,
feat: implementation of torch.cdist function to pytorch frontend.
The shape of the two input arrays 'x1' and 'x2' is three dimensional tensors (BxRxM), so I check if the shape of both tensors is 3 otherwise an exception occurs.
the torch.cdist function does not accept float16 as a type therefore float32 and float 64 types were used.
the parameter 'p' recieves values from 0 to inf so I set minimum number 0 and maximum number 1 million. Is that correct? Maybe I need to use math.inf.
The parameter 'compute mode' is a tricky one. It handles the special case of p=2 (euclidean distance) and it specifies whether or not matrix multiplication (mm) will be used for the calculation of the distances . Therefore, I implemented both ways, the mm way with ivy.vector_norm and the not_mm way with 3 for loops. I am sure if this is the correct way but the tests pass for all five (5) backends.
Thank you for your time, I am looking forward for your response.
Close #26797
Checklist
Socials
Linkdin - linkedin.com/in/zois-tsakiris-759062286